﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using System.Data;
using System.Data.SqlClient;

namespace BLL
{
    class TINHTRANGPMBLL
    {
        DataService DB = new DataService();

        public void insert(string tentinhtrangpm)
        {

            string sql = "insert into tinhtrangpm values (@tentinhtrangpm)";
            SqlParameter paraTen = new SqlParameter("tentinhtrangpm", tentinhtrangpm);
            DB.ExecuteNonQuery(sql, paraTen);

        }

        public void updateTenTinhtrangWithID(int idTinhtrang, string tenTinhtrang)
        {

            string sql = "update tinhtrangpm set tentinhtrangpm = '" + tenTinhtrang + "' where matinhtrangpm = " + idTinhtrang.ToString();
            DB.ExecuteNonQuery(sql);
        }

        public void deleteTinhtrangWithID(int idTinhtrang)
        {
            string sql = "delete from tinhtrangpm where matinhtrangpm = " + idTinhtrang.ToString();
            DB.ExecuteNonQuery(sql);
        }

    }
}
